package com.hctforgreen.greenservice.model;

import org.json.JSONException;
import org.json.JSONObject;

public class ResultEntity extends BaseEntity {
	private static final long serialVersionUID = 1763969765820367713L;
	/**
	 * HctConstants.RESULT_STATE_SUCCESS HctConstants.RESULT_STATE_FAILD
	 * HctConstants.RESULT_STATE_EXCEPTION
	 */
	public String statusCode = "";
	public String msg = "";
	public String state = "";

	public final static String STATE = "state";
	public final static String STATE_CODE = "statusCode";
	public final static String MSG = "msg";

	public static ResultEntity parse(JSONObject jsonObject) throws JSONException {
		ResultEntity bean = new ResultEntity();
		if (jsonObject.has(STATE_CODE)) {
			bean.statusCode = jsonObject.getString(STATE_CODE);
		}
		if (jsonObject.has(MSG)) {
			bean.msg = jsonObject.getString(MSG);
		}
		if (jsonObject.has(STATE)) {
			bean.state = jsonObject.getString(STATE);
		}
		return bean;
	}
}
